#include <stdio.h>
#include <string.h>

int main(void)
{
    // +QMTRECV: 0,2,"861681054218848_cmd",395,"cfg -hub mac:34dac1130951,product_id:17,node_num:10"
    char at_recv_buf[] = "+QMTRECV: 0,2,\"861681054218848_cmd\",395,\"cfg -hub mac:34dac1130951,product_id:17,node_num:10\"";
    int num1, num2, recvBytes;
    char topic[20] = {0};
    char pbuf[100];

    sscanf(strstr(at_recv_buf, "+QMTRECV"), "+QMTRECV: %d,%d,\"%[^\"]\",%d,\"%[^\"]\"", &num1, &num2, topic, &recvBytes, pbuf);     // regex

    printf("num1 = %d, num2 = %d, recvBytes = %d\r\n", num1, num2, recvBytes);
    printf("topic: [%s]\r\n", topic);
    printf("pbuf: [%s]\r\n", pbuf);

    return 0;
}
